from .base import BaseConfig
from lib.conf.config import settings


class Basic(BaseConfig):

    def process(self, command_func, debug):
        if debug:
            output = {
                'os_platform': "123",
                'os_version': "#1 123 Thu Nov 8 23:39:32 UTC 2018",
                'hostname': 'ceshi'
            }
        else:
            output = {
                # 获取系统名称，如：Linux
                'os_platform': command_func("uname").strip(),
                # 获取操作系统类型，如：centos/ubuntu
                'os_version': command_func("uname -v").strip().split('\n')[0],
                # 获取操作服务器的主机名
                'hostname': command_func("hostname").strip(),
            }
        return output
